<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>操作票更新</title>
<script type="text/javascript" src="<%=basePath%>js/jquery-1.4.4.min.js"></script>
<script src="<%=basePath%>uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath%>uploadify/uploadify.css">
<script type="text/javascript">
	$(function() {
		$("#file_upload").uploadify({
			height        : 30,
			swf           : '<%=basePath%>uploadify/uploadify.swf',
			uploader      : '<%=basePath %>czp/save',
			width         : 120
		});
	});

	$(function() {
		$("#addmore")
				.click(
						function() {
							var count = Math.floor(Math.random() * 10000);
							$("#fileUpLoad")
									.append(
											'<div><input type="file" id="upload" name="file'+count+'"><a href="#" id="close">删除</a><br></div>');
						});
		$("#subButton").click(function(){
			var result = $("input[id='upload']");
			var flag = 0;
			for(var i = 0; i < result.length; i++){
				if(result[i].value != "")
					flag = 1;
			}
			if(flag == 1)
				return true;
			else{
				alert("请选择文件!");
				return false;
			}
				
			
		});
		$("#close").live("click", function() {
			$(this).parent().remove();
		});
	});
</script>
</head>
<body>
	<h2 align="center">操作票更新页面</h2>
	<h5 align="center">
		需上传多个文件时请单击“添加”按钮，会新增一行文件上传栏，点击删除会删除这一行的文件上传栏<br>选择好文件点击“上传”后文件将上传至服务端，相应的文件版本号也会自动更新
	</h5>
	<h5 align="center">目录：${uploadFilePath }</h5>
	<form action="<%=basePath %>czp/save" enctype="multipart/form-data" method="post">
		<table style="width: 300px" align="center">
			<tr>
				<td>
					<table>
						<tr>
							<td id="fileUpLoad">
								<div>
									<input type="file" name="file1" id="upload"><a href="#"
										id="close">删除</a><br>
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<input type="submit" value="上传" id="subButton">
								<input type="button" value="添加" id="addmore">
								<input type="button" onclick="window.location.href='<%=basePath%>czp'" value="返回目录"></td>
						</tr>
					</table>
				</td>
				<td valign="top">
					<table>
						<tr>
							<td>
								<div id="queue"></div>
								<input id="file_upload" name="file_upload" type="file" multiple="true">
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>